package org.jeecg.modules.videoMapping.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.jeecg.modules.videoMapping.entity.VideoMapping;
import org.jeecg.modules.videoMapping.mapper.VideoMappingMapper;
import org.jeecg.modules.videoMapping.service.IVideoMappingService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * @Description: 视频流地址映射
 * @Author: jeecg-boot
 * @Date:   2024-10-09
 * @Version: V1.0
 */
@Service
public class VideoMappingServiceImpl extends ServiceImpl<VideoMappingMapper, VideoMapping> implements IVideoMappingService {

    @Override
    public VideoMapping getByLocationAndChannel(String location, String channel) {
        LambdaQueryWrapper<VideoMapping> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(VideoMapping::getLocation, location);
        wrapper.eq(VideoMapping::getChannel, channel);
        return baseMapper.selectOne(wrapper);
    }

    @Override
    public VideoMapping getByChannelCode(String channelCode) {
        LambdaQueryWrapper<VideoMapping> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(VideoMapping::getChannelCode, channelCode);
        return baseMapper.selectOne(wrapper);
    }
}
